YAHOO.namespace("ajaxstack");
YAHOO.ajaxstack.PathTests = new YAHOO.tool.TestCase({

	name: "Path Tests",

	//--------------------------------------------- 
	// Setup and tear down 
	//---------------------------------------------

	setUp: function()
	{
	},

	tearDown: function()
	{
	},

	//--------------------------------------------- 
	// Tests
	//---------------------------------------------

	assertPathInfo: function(path, pageName, arguments, options)
	{
		arguments = arguments || [];
		options = options || {};
		Assert.areEqual(pageName, path.getName());
		ArrayAssert.itemsAreEqual(arguments, path.getArgs());
		ObjectAssert.propertiesAreEqual(options, path.getOptions());
	},

	testPathParse: function()
	{
		this.assertPathInfo(Path.parse('pageName'), 'pageName');
		this.assertPathInfo(Path.parse('pageName/a'), 'pageName', ['a']);
		this.assertPathInfo(Path.parse('pageName/a/b'), 'pageName', ['a', 'b']);
		this.assertPathInfo(Path.parse('pageName/a/b?c=d'), 'pageName', ['a', 'b'], { c: 'd' });
		this.assertPathInfo(Path.parse('pageName/a/b?c=d&e=f'), 'pageName', ['a', 'b'], { c: 'd', e: 'f' });
	},

	testGetFirstArg: function()
	{
		Assert.isNull(Path.getFirstArg('pageName'));
		Assert.areEqual('a', Path.getFirstArg('pageName/a'));
		Assert.areEqual('a', Path.getFirstArg('pageName/a/b'));
		Assert.areEqual('a', Path.getFirstArg('pageName/a/b?c=d&e=f'));
	},

	testToHref: function()
	{
		Assert.areEqual('#pageName/a', Path.parse('pageName/a').toHref());
		Assert.areEqual('#pageName/a/b', Path.parse('pageName/a/b').toHref());
		Assert.areEqual('#pageName/a/b?c=d', Path.parse('pageName/a/b?c=d').toHref());
		Assert.areEqual('#pageName/a/b?c=d&e=f', Path.parse('pageName/a/b?c=d&e=f').toHref());
	},

	testNameEquals: function()
	{
		var pathA = Path.parse('pageName/a');
		var pathB = Path.parse('pageName/b');
		Assert.isTrue(pathA.nameEquals(pathA));
		Assert.isTrue(pathA.nameEquals(pathB));
		Assert.isTrue(pathA.nameEquals('pageName/b'));
	},

	testWip: function()
	{
	}

});

